package com.translate.web.service.impl;

import com.translate.web.constant.RedisConstant;
import com.translate.web.dao.TeamSigningRewardsMapper;
import com.translate.entity.TeamSigningRewards;
import com.translate.vo.contract.ITeamSigningRewardsVO;
import com.translate.web.service.ITeamSigningRewardsService;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

@Service
public class TeamSigningRewardsServiceImpl extends BaseTranslateServiceImpl<TeamSigningRewards>
		implements ITeamSigningRewardsService {
	public TeamSigningRewardsServiceImpl(TeamSigningRewardsMapper mapper) {
		super(mapper);
	}

	protected void insertPropteris(TeamSigningRewards data) {
		long time = System.currentTimeMillis() / 1000;
		data.setCreateTime(time);
		data.setUpdateTime(time);
	}

	protected void updatePropteris(TeamSigningRewards data) {
		data.setUpdateTime(System.currentTimeMillis() / 1000);
	}

	protected Class<TeamSigningRewards> getEntityClass() {
		return TeamSigningRewards.class;
	}

	@Resource
	public void setRedisTemplate(RedisTemplate<String, List<TeamSigningRewards>> redisTemplate) {
		this.redisTemplate = redisTemplate;
	}
	
	@Override
	public <VO extends ITeamSigningRewardsVO> List<VO> getListFromCache(Class<VO> target) {
		List<TeamSigningRewards> listToCache = this.listToCache(RedisConstant.TEAM_SIGN_KEY, 11);

		return entityConvertToVo(listToCache, target);
	}
}